package com.surprise.ods;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;

import com.surprise.base.BaseBeanConfig;
import com.surprise.ods.sms.SmsInterfaceServiceLocator;

/**
 * RedisBeanConfig.java
 * @author nick
 * 2015年2月4日
 */
@Configuration
@ComponentScan(basePackages = "com.surprise.ods",
        excludeFilters = @Filter(type = FilterType.REGEX, pattern = {
                "com.surprise.ods.util", "com.surprise.ods.po",
                "com.surprise.ods.bo" }))
@Import(BaseBeanConfig.class)
@PropertySource({"classpath:/common-ods.properties"})
public class OdsBeanConfig {
    @Bean
    public static PropertySourcesPlaceholderConfigurer propertyConfigurer2() {
        PropertySourcesPlaceholderConfigurer order = new PropertySourcesPlaceholderConfigurer();
        order.setOrder(2);
        order.setIgnoreUnresolvablePlaceholders(true);
        return order;
    }
    
    @Bean
    public SmsInterfaceServiceLocator smsInterfaceFactory() {
    	SmsInterfaceServiceLocator service = new SmsInterfaceServiceLocator();
    	service.setSmsInterfaceEndpointAddress("http://ws.iems.net.cn/GeneralSMS/ws/SmsInterface?wsdl");
    	return service;
    }
}
